package comits.web.client.servlets.demo;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import comits.business.tiers.dao.FrontiereDAO;
import comits.business.tiers.dao.FrontiereDAOImpl;

/**
 * 
 * @author Dourga
 */
public class FrontiereServlet extends HttpServlet {
	
	private static final long serialVersionUID = 7526928611471348888L;
	

	protected void processRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	
	}
	
	
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		HttpSession session = request.getSession(); 
		
		
		int A =  Integer.parseInt(request.getParameter("AB"));
		int B =  Integer.parseInt(request.getParameter("BC"));
		B = B+A;
		
		FrontiereDAO front = new FrontiereDAOImpl();
		front.ModifierFrontiereA(A);
		front.ModifierFrontiereB(B);
		
		session.setAttribute("frontA",A);
		session.setAttribute("frontB",B);
	
		getServletContext().getRequestDispatcher("/ValiderClassif.jsp").forward(request, response);
		
	}

	/**
	 * Returns a short description of the servlet.
	 * 
	 * @return a String containing servlet description
	 */
	public String getServletInfo() {
		return "Short description";
	}// </editor-fold>
}
